<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>JS中有三种定义函数的方式</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
	
	<script type="text/javascript">
		/*正常方式(先)
		function add(num1,num2){
			return num1 + num2;
		}
		window.alert("10+20=" + add(10,20));
		*/
	</script>
	
	<script type="text/javascript">
		/*构造器方式，最后一个参数为函数体，每个参数都是字符串类型(后)
		var add = new Function("num1","num2","return num1+num2");
		window.alert("100+200=" + add(100,200));
		*/
	</script>
	
	<script type="text/javascript">
		/*直接量或匿名或无名方式(再)
		var add = function(num1,num2){
						return num1 + num2;
				  }
		window.alert("1000+2000=" + add(1000,2000)); 
		*/ 
	</script>
	
  </body>
</html>
